<SCRIPT language="javascript1.1" type="text/javascript">
function Link() {ldelim}
	AnCode = "<a target=\""+document.getElementById('targets').value+"\" href=\""+document.getElementById('links').value+"\">";
	top.opener.window.insertImagePopUp('text{$smarty.get.field_id}', AnCode);
	window.close()
{rdelim}
</SCRIPT>
{capture name="hidden"}		
{/capture}	
{capture name="fields"}
<!-- * -->
		<table width="100%" cellpadding="3" cellspacing="0">
			<tr>
				<td width="35%" height="1"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>					
			</tr>
			<tr>
				<td>{t t='url_type'}:</td>
				<td>
				<select id="url_types" name="url_type" onChange="document.getElementById('links').value = this.value;" class="defaultInputText">
					<option value="http://" selected>http:</option>
					<option value="mailto:">mailto:</option>
				</select>
				</td>
			</tr>
			<tr>
				<td height="3" colspan="2">
				<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td height="1" bgcolor="#D1D8DB"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td width="35%" height="1"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
				<td><img src="client/img/spacer.gif" class="spacer" alt="" /></td>					
			</tr>
			<tr>
				<td>{t t='link'}:</td>
				<td><input id="links" type="text" name="lin" value="http://" class="defaultInputText"></td>
			</tr>
			<tr>
				<td height="3" colspan="2">
				<table width="100%" cellpadding="0" cellspacing="0">
					<tr>
						<td height="1" bgcolor="#D1D8DB"><img src="client/img/spacer.gif" class="spacer" alt="" /></td>
					</tr>
				</table>
				</td>
			</tr>
			<tr>
				<td>{t t='open_target'}:</td>
				<td>
				<select id="targets" name="target" style="width:100% ">
				<option value="_blank">{t t='Naujame lange'}</option>
				<option value="_self" selected>{t t='Tame pačiame lange'}</option>
				</select>
				</td>
			</tr>			
		</table>	
<!-- /* -->
<SCRIPT language="javascript1.1" type="text/javascript">
function ChangeLin() {ldelim}
	var nSelectedIndex=new Number();
	var tControl = top.opener.window.document.all['text{$smarty.get.field_id}'].DOM.selection.createRange();
	tControl = tControl.parentElement();
	if (tControl.tagName.toLowerCase()== 'a'){ldelim}
		if ((tControl.href != "") && (tControl.href != "#")) {ldelim}
			document.getElementById("links").value = tControl.href;
			if (tControl.href.indexOf("http") == 0) document.getElementById("url_types").selectedIndex = 0;
			else if (tControl.href.indexOf("mailto") == 0) document.getElementById("url_types").selectedIndex = 1;
		{rdelim}
		if (tControl.target != "") {ldelim}
			for (i=0; i<document.getElementById("targets").options.length; i++) {ldelim}
				if (document.getElementById("targets").options[i].value == tControl.target) {ldelim}
					document.getElementById("targets").selectedIndex = i;
					break;
				{rdelim}
			{rdelim}
		{rdelim}
	{rdelim}
{rdelim}
ChangeLin();
</SCRIPT>
{/capture}